package test

import java.math.BigInteger

fun main(args: Array<String>) {
    var num = BigInteger("100")
    //计算100的阶乘
    println(fact(num))
}

fun fact(num: BigInteger):BigInteger {
    if (num == BigInteger.ONE) {
        return BigInteger.ONE
    } else {
        return num * fact(num - BigInteger.ONE)
    }
}